
import React, { useState, useContext, useRef } from "react";
import One from "./one";
export default function App() {
    let spans = useRef()
    let pp = useRef()
    let hh1 = useRef()
    let getOne = useRef()
    function add() {
        // console.log(getOne, "s")
        getOne.current.isDispaly()
    }
    return (
        <div>
            <button onClick={add}>点击显示隐藏</button>
            <One ref={getOne}></One>
            {/* useRef只能获取类组件和元素 */}
            <span ref={spans}></span>
            <p ref={pp}></p>
            <h1 ref={hh1}></h1>
        </div>
    )
}